package site.koudai.cloud.config;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import site.koudai.cloud.interceptor.DataPermissionInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private DataPermissionInterceptor dataPermissionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加拦截器，并设置拦截规则
        registry.addInterceptor(dataPermissionInterceptor)
                .addPathPatterns("/**"); // 拦截所有请求
        //.excludePathPatterns("/path/to/exclude"); // 排除特定路径
    }
}
